<?php
C_base::Dy('c.admin.adbase');
class pinglungl extends adbase{
	var $_vpath='admin/pinglun/';  //定义调用模板所属一级文件夹
	var $srr = array();
	
	function __construct(){
		parent::__construct();
		$this->titl = '评论管理';
		$this->xurl = '/admin/?act=pinglun'.$this->gnpd;
	}
	
	/**
	 * 评论列表
	 */
	function index(){
		$this->tit = '评论列表';
		$this->con = C_base::M('public')->con_s();
		$this->mk = json_encode(explode(',',$this->con['plmk']));
		$this->r = array();
		for($i=0;$i<10;$i++){
			$r = C_base::M('admin.pinglungl')->pinglun_ss($i,array());
			if(!empty($r)){
				foreach($r as $k => $v){
					if($v){
						$this->r[] = $v;
					}
				}
			}
		}
	}
	
	/**
	 * 修改评论相关设置
	 */
	function plcon_u(){
		extract($this->_post());
		if($nmtype == '0' && $dltype == '1'){
			exit('-1');//启用匿名评论需先启用登录评论
		}
		$u = array('dlpl'=>$dltype,'nmpl'=>$nmtype,'yzmpl'=>$yzmtype,'plmk'=>implode(',',$mktype));
		$r = C_base::M('public')->con_u(array(),$u);
		if($r == '1'){
			exit('cg');
		}else{
			exit('error');
		}
	}
	
	/**
	 * 评论详情页
	 */
	function pinglun_xx(){
		$this->tit = '评论详情页';
		extract($this->_get());
		$con = C_base::M('public')->con_s();
		$this->yzmkq = $con['yzmpl'];
		$w = array('id'=>$id,'zid'=>$zid);
		$this->r = C_base::M('admin.pinglungl')->pinglun_s($zid,$w);
	}
	
	/**
	 *	取出评论下的全部回复
	 */
	function bb($va,$ss,$i){
		foreach($va as $k => $v){
			$this->srr[$i][] = $v;
			$a = @$ss[$v['id']];
			if($a){
				self::bb($a,$ss,$i);
			}
		}
	}
	
	/**
	 * 删除评论
	 */
	function pinglun_sc(){
		extract($this->_post());
		$w = array('id'=>$id,'zid'=>$zid);
		$r = C_base::M('admin.pinglungl')->pinglun_d($zid,$w);
		if($r == '1'){
			exit('cg');
		}else{
			exit('error');
		}
	}
	
}
/*********************************************************************文件已结束*****************************************************************/